﻿using System.Collections.ObjectModel;
using System.ComponentModel;

namespace GlobalizationTools.ViewModel
{
    public class ResourceEntry : INotifyPropertyChanged
    {
        private ObservableCollection<ResourceData> _values = new ObservableCollection<ResourceData>();
        private string _originalName;
        private string _name;

        public ResourceEntry()
        {
            _originalName = string.Empty;
        }

        public ResourceEntry(string name)
        {
            _originalName = name;
            _name = name;
        }

        public string OriginalName
        {
            get { return _originalName; }
            set { _originalName = value; }
        }

        public string Name
        {
            get { return _name; }
            set
            {
                if (_name != value)
                {
                    _name = value;
                    OnPropertyChanged("Name");
                }
            }
        }

        public ObservableCollection<ResourceData> Values
        {
            get { return _values; }
        }

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void OnPropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }

        #endregion // INotifyPropertyChanged Members

    }
}
